import java.util.Collections;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.Query;

import model.Employee;
import service.JPAUtil;


public class JPATester {

	public static void main(String[] args) {
		JPAUtil jpautil = new JPAUtil();
		/*
		EntityManager em = jpautil.getEm();
		Employee emp = new Employee();
		EntityTransaction et = em.getTransaction();
		//emp = em.merge(emp);
		Query query = em.createNamedQuery("Employee.findAll", Employee.class);
		List<Employee> empList = query.getResultList();
		//Collections.sort(empList);
		System.out.println(empList.get(0));
		*/
		List<Employee> empList = jpautil.findAll(Employee.class);
		System.out.println(empList.isEmpty());
		System.out.println("########################## All Emp List ##############################");
		System.out.println(empList);
		System.out.println("########################## End of Emp List ##############################\n");
		//###################################
		Employee emp = jpautil.findByKey(Employee.class, new Integer(101));
		System.out.println(emp);
		//System.out.println(emp.getEmployeeId());
		
	}

}
